<?php               
session_start();
$_SESSION['etat'] ='Connexion';
$_SESSION['tentative']=0;
$balise_compt='&nbsp;&nbsp;&nbsp;&nbsp;|
                         <span  class="warning_1">
                            <a href="./?page_id=Ajouter_user">creer votre compte</a>
                        </span>&nbsp;&nbsp;&nbsp;&nbsp;';
$creer_compt=$balise_compt;
if(isset($_SESSION['user'])){
    $_SESSION['etat'] ='Deconnexion';
    $creer_compt='';
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<!--[if lt IE 7]>
	<link href="js/ie_style.css" rel="stylesheet" type="text/css" />
   <script type="text/javascript" src="js/ie_png.js"></script>
   <script type="text/javascript">
       ie_png.fix('.png, .button');
   </script>
<![endif]-->
</head>

<body id="page1">
  <!-- header -->

  <div id="header">
    <div class="container">
    	<!-- .logo -->
    	<div class="logo">
      	<a href="index.html"><img src="images/logo.gif" alt="" /></a>
      </div>
    	<!-- /.logo -->
      <!-- .slogan -->
      <div class="slogan">
      	<h1>Affaire Sans Risque</h1>
       <!-- <h2>Thiebthieb pour faciliter la vie, vous pouvez vendre vos objets sans déplacer</h2>-->
      <div id="search_box" >
       <br/><br/><br/>
			<table>
	
			<form action="" method="post">

<tr>
 <td> <input type="text" name="textrecher"/ size="30"> </td>
 <td>	
 <?php
include_once("../classeBDD/connectBdd.php");
$sql = sql::connect();
$requete = $sql->query('SELECT * FROM categorie');

?>
 <select name="categorie">
 <?php
  // On affiche chaque entrée une à une
    while($resultat = $sql->fetch_array($requete)) 
	{
	?>
    <option value=" <?php echo $resultat['id_categorie']; ?>"> <?php echo $resultat['nom_categorie']; ?></option>
 <?php } ?>

 </select>

 
 </td>
 <td>
 <?php
 $requete = $sql->query('SELECT * FROM region');
 ?>
 <select name="categorie" >
 <?php
  // On affiche chaque entrée une à une
    while($resultat = $sql->fetch_array($requete)) 
	{
	?>
    <option value=" <?php echo $resultat['id_region']; ?>"> <?php echo $resultat['nom_region']; ?></option>
 <?php } ?>

 </select>
 </td>
 <td><input type="button" value="Chercher"/></td>
 </tr>
</form>
</table>
</div>
      </div>
       <div class="fenetre_connexion">
      	<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td align="right">
                        <span class="txt_3"> 
                            <span class="txt_3g">
                                <?php if(isset($_SESSION['user']))echo 'Welcome    '.$_SESSION['user']; ?>
                            </span>
                            today is <?php echo date('d/m/y');?>&nbsp;&nbsp;|
                        </span>&nbsp;&nbsp;
                        <span  class="warning_1">
                            <a href="./index.php?page_id=<?php if(isset($_SESSION['etat'])) echo $_SESSION['etat'] ;?>"><?php if(isset($_SESSION['etat'])) echo  $_SESSION['etat'] ;?></a>
                        </span>
                        <?php if(isset($creer_compt)) echo  $creer_compt;?>
                    </td>
                  </tr>
                </table>
                 
      </div>
      
      <!-- /.slogan -->
      <!-- .nav -->
      <?php

    require_once("menu.php");
    $menu = affiche_menu();
                 echo $menu;
		?>
      <!-- /.nav -->
    </div>
</div>
  <!-- content -->
  <div id="content">
  	<div class="container">
  	  <div class="inside">
  	    <div class="wrapper">
  	      <div class="aside">
  	      	<h2><span><img src="images/icon1.gif" alt="" />Category</span></h2>
            <!-- .block -->
            <div class="block">
            	<ins class="lbc"></ins>
              <ins class="rbc"></ins>
            	<ul class="list1">
              	<li><a href="#">Consulter les annonces</a></li>
                <li><a href="#">Diffuser une annonce</a></li> 
                <li><a href="./index.php?page_id=listeroffres">Offres</a></li> 
                <li><a href="./index.php?page_id=listerdemande">Demande</a></li> 
                <li><a href="#">Compte pro</a></li>
                <li><a href="./index.php?page_id=modifier_vos_Annonces">Mes annonces </a></li>
                <li><a href="./index.php?page_id=Ajouter_user">Inscription</a></li> 
                <li><a href="#">Membres</a></li>
                <li><a href="#">Aides</a></li>
               
              </ul>
            </div>
            <!-- /.block -->
  	      </div>
  	      <div class="mainContent">
            <?php 
                $page_inc = '../PEARDIR/listertout.php';
                
                if (isset($_GET['page_id'])) {
                    switch ($_GET['page_id']) {
                         case 'listerdemande':
                            $page_inc ='../PEARDIR/listerdemande.php';
                            break;
                         case 'listeroffres':
                            $page_inc ='../PEARDIR/listeroffres.php';
                            break;
                        case 'listertout':
                            $page_inc ='../PEARDIR/listertout.php';
                            /*if(isset($_GET['page']))
                                $page_inc ='../formCRUD/listertout.php?page=';*/
                            break;
                        case 'listerProff':
                            $page_inc ='../PEARDIR/listerProff.php';
                            break;
                         case 'listerparti':
                            $page_inc ='../PEARDIR/listerparti.php';
                            break;
                        case 'modifier_vos_Annonces':
                            $page_inc ='./Modifier_Annonces.php';
                            if(!isset($_SESSION['user']))
                                 $page_inc ='./login.php';
                            break;
                        case 'Ajouter_user':
                            $page_inc ='./Ajouter_user.php';
                            break;
                        case 'Formulaire_modif':
                            $page_inc ='./Formulaire_modif.php';
                             break;
                        case 'Connexion':
                            $page_inc = './login.php';
                            break;
                        case 'Deconnexion':
                            $page_inc = './Afficher_Annonces.php';
                            if(isset($_SESSION['user']))
                                   session_unset($_SESSION['user']);
                            $_SESSION['etat'] ='Connexion';
                            $creer_compt=$balise_compt;
                            break;
                        case 'Afficher_Annonces':
                            if(isset($_SESSION['user']))
                            $etat='Deconnecter';
                            $page_inc = '../PEARDIR/listertout.php';
                            break;
                        case 'ajout_Annonce':
                            if(!isset($_SESSION['user']))
                            $page_inc = './formulaire_ajoutAnnonce.php';
                            else $page_inc='./formulaire_ajoutAnnonce_conecter.php';
                            break;
                       case 'action_annonce':
                            $page_inc = './action_annonce.php';
                            break;
                        default:
                            $page_inc = './Afficher_Annonces.php';

                    }
                }
            ?>

            <?php include $page_inc; ?>
                  <?php //include '../PEARDIR/listertout.php'; ?>



          </div>
  	    </div>
  	  </div>
  	</div>
</div>
  <!-- footer -->
  <div id="footer">
  	<div class="container">
    	<div class="inside">
      	<div class="wrapper">
        	<dl class="contact">
          	<dt>The Company Name Inc. 8901 Marmora Road, Glasgow, D04 89GR.</dt>
            <dd>Telephone: +1 959 552 5963</dd>
            <dd>FAX: +1 959 552 5964</dd>
            <dd>E-mail:  <a href="#">mail@demolink.org</a></dd>
          </dl>
          <!-- .footer-box -->
          <div class="footer-box">
          	<div class="indent">
         <div class="vlinks"><a href="http://www.webdesign.org">Web design</a> by <a title="Free Templates Online" href="http://www.freetemplatesonline.com">Free Templates</a> Online</div>

          	</div>
          </div>
          <!-- /.footer-box -->
        </div>
      </div>
    </div>
  </div>
</body>
</html>